package com.ywq.wechatordersys.utils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ywq.wechatordersys.data.OrderDetail;
import com.ywq.wechatordersys.exception.MyException;

import java.lang.reflect.Type;
import java.util.List;

public class JsonUtil {


    public static <T> T json2Bean(String json, Type type)

    {

        Gson gson = new Gson();
        T o;
        try {
              o = gson.fromJson(json, type);
        } catch (Exception e) {
            throw new MyException(100, json + "json转换异常" + type);
        }


        return o;
    }
}
